import { request } from '@/service/request';
import { SysLoginLog } from "~/src/views/system/log/login-log/index";

export function fetchLog(id: Common.IdType) {
  return request({
    url: `/system/log/${id}`,
    method: 'GET',
  });
}

export function fetchLogPage(page: Common.Page<SysLoginLog>, searchData: any) {
  return request({
    url: '/system/log/list',
    data: { page, searchData },
    method: 'POST',
  });
}

export function fetchAddLog(data: SysLoginLog) {
  return request({
    url: '/system/log/',
    data: data,
    method: 'POST',
  });
}

export function fetchUpdateLog(data: SysLoginLog) {
  return request({
    url: '/system/log/',
    data: data,
    method: 'PUT',
  });
}

export function fetchDelLog(ids: Common.IdType[]) {
  // 假设服务器端期望接收逗号分隔的 ID 字符串
  return request({
    url: `/system/log/${ids}`,
    method: 'DELETE',
  });
}

export function fetchClearLog() {
  return request({
    url: '/system/log/clear',
    method: 'DELETE',
  });
}

export function fetchWorkBenchLoginLog() {
  return request({
    url: '/system/log/workBenchLoginLog',
    method: 'POST',
  });
}
